// 学生信息
export interface Student {
  id: string;
  name: string;
  studentNumber: string;
  classId: string;
  avatar?: string;
  createdAt: Date;
  updatedAt: Date;
}

// 班级信息
export interface Class {
  id: string;
  name: string;
  description?: string;
  teacherId: string;
  studentIds: string[];
  createdAt: Date;
  updatedAt: Date;
}

// 作业信息
export interface Homework {
  id: string;
  title: string;
  description?: string;
  studentId: string;
  classId: string;
  images: HomeworkImage[];
  files: HomeworkFile[];
  status: 'submitted' | 'grading' | 'graded' | 'returned';
  score?: number;
  feedback?: string;
  submittedAt: Date;
  gradedAt?: Date;
  createdAt: Date;
  updatedAt: Date;
}

// 作业图片
export interface HomeworkImage {
  id: string;
  homeworkId: string;
  originalUrl: string;
  processedUrl?: string;
  thumbnailUrl?: string;
  metadata: ImageMetadata;
  annotations?: Annotation[];
  order: number;
  createdAt: Date;
}

// 作业文件
export interface HomeworkFile {
  id: string;
  homeworkId: string;
  fileName: string;
  fileUrl: string;
  fileSize: number;
  fileType: string;
  order: number;
  createdAt: Date;
}

// 图片元数据
export interface ImageMetadata {
  width: number;
  height: number;
  size: number;
  format: string;
  quality?: number;
  processingHistory: ProcessingStep[];
}

// 图片处理步骤
export interface ProcessingStep {
  type: 'crop' | 'enhance' | 'rotate' | 'filter';
  parameters: Record<string, any>;
  timestamp: Date;
}

// 图片标注
export interface Annotation {
  id: string;
  type: 'text' | 'arrow' | 'highlight' | 'shape';
  position: {
    x: number;
    y: number;
    width?: number;
    height?: number;
  };
  content?: string;
  style: {
    color: string;
    fontSize?: number;
    strokeWidth?: number;
  };
  createdAt: Date;
}

// 教学任务
export interface TeachingTask {
  id: string;
  name: string;
  subject: 'math' | 'chinese' | 'english' | 'physics' | 'chemistry' | 'other';
  description?: string;
  classId: string;
  studentIds: string[];
  startTime: Date;
  endTime: Date;
  status: 'pending' | 'grading' | 'correction' | 'correcting' | 'completed';
  files: TaskFile[];
  createdAt: Date;
  updatedAt: Date;
}

// 任务文件
export interface TaskFile {
  id: string;
  taskId: string;
  fileName: string;
  fileUrl: string;
  fileSize: number;
  fileType: string;
  order: number;
  createdAt: Date;
}

// 用户信息
export interface User {
  id: string;
  name: string;
  email: string;
  password: string;
  role: 'teacher' | 'student';
  avatar?: string;
  // 教师特有字段
  teacherId?: string;
  subject?: string[];
  classes?: string[];
  // 学生特有字段
  studentId?: string;
  class?: string;
  grade?: string;
  createdAt: string;
  updatedAt: string;
}

// 认证相关类型
export interface LoginForm {
  email: string;
  password: string;
  role: 'teacher' | 'student';
}

export interface RegisterForm {
  name: string;
  email: string;
  password: string;
  confirmPassword: string;
  role: 'teacher' | 'student';
  // 教师特有字段
  teacherId?: string;
  subject?: string[];
  classes?: string[];
  // 学生特有字段
  studentId?: string;
  class?: string;
  grade?: string;
}

export interface AuthState {
  isAuthenticated: boolean;
  currentUser: User | null;
  token: string | null;
}

// 通知信息
export interface Notification {
  id: string;
  title: string;
  content: string;
  type: 'task' | 'grading' | 'system';
  userId: string;
  isRead: boolean;
  createdAt: Date;
}

// API响应类型
export interface ApiResponse<T = any> {
  success: boolean;
  data?: T;
  message?: string;
  code?: number;
}

// 分页参数
export interface PaginationParams {
  currentPage: number;
  pageSize: number;
  total: number;
}

// 搜索参数
export interface SearchParams {
  keyword?: string;
  subject?: string;
  status?: string;
  dateRange?: [Date, Date];
}

// 摄像头配置
export interface CameraConfig {
  width: number;
  height: number;
  facingMode: 'user' | 'environment';
  quality: number;
}

// 图片处理配置
export interface ImageProcessingConfig {
  enableCrop: boolean;
  enableEnhance: boolean;
  enableRotate: boolean;
  quality: number;
}